# 定义编译器
CC = gcc

# 定义编译选项
CFLAGS = -Wall -Wextra -O2

# 定义链接库
LDFLAGS = -lnetsnmp -lmysqlclient

# 目标文件
TARGET = asynchapp
# 源文件
SRC = asynchapp.c

TARGET2 = old
SRC2 = old.c

TARGET3 = snmpdemoapp
SRC3 = snmpdemoapp.c

# 默认目标
all: $(TARGET) $(TARGET2) $(TARGET3)

# 编译规则
$(TARGET): $(SRC)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

$(TARGET2): $(SRC2)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

$(TARGET3): $(SRC3)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

# 清理编译生成的文件
clean:
	rm -f $(TARGET)

.PHONY: all clean